package com.alinesno.cloud.busines.demo.gateway.rest;

import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.alinesno.cloud.common.core.constants.SpringInstanceScope;
import com.alinesno.cloud.common.facade.pageable.DatatablesPageBean; 
import com.alinesno.cloud.rest.gateway.adapter.plugins.TranslateCode;
import com.alinesno.cloud.rest.gateway.adapter.page.TableDataInfo;
import com.alinesno.cloud.rest.gateway.adapter.rest.BaseRestAdapter;

import com.alinesno.cloud.busines.demo.entity.CourseCollegeEntity;
import com.alinesno.cloud.busines.demo.service.ICourseCollegeService;

/**
 * 班级Rest
 *
 * @author wh ${authorEmail}
 * @date 2021-09-06 22:52:32
 */
@RestController
@Scope(SpringInstanceScope.PROTOTYPE)
@RequestMapping("/api/student/CourseCollege")
public class CourseCollegeRest extends BaseRestAdapter<CourseCollegeEntity, ICourseCollegeService> {

    //日志记录
    private static final Logger log = LoggerFactory.getLogger(CourseCollegeRest.class);

    @Autowired
    private ICourseCollegeService courseCollegeService;

    @TranslateCode
    @ResponseBody
    @PostMapping("/datatables")
    public TableDataInfo datatables(HttpServletRequest request, Model model, DatatablesPageBean page) {
        log.debug("page = {}", ToStringBuilder.reflectionToString(page));
        return this.toPage(model, this.getFeign() , page) ;
    }

    @Override
    public ICourseCollegeService getFeign() {
        return this.courseCollegeService;
    }
}
